{extend name="layout/layout" /}

{block name="content"}
<div class="row js-check-wrap">
    <div class="col-lg-12">
        <div class="portlet light">
            <div class="box-header">
                <div class="row">
                    {include file="common:search" /}
                    <div class="col-md-2">
                        <div class="pull-right">
                            <button type="button" class="btn dark btn-circle" data-toggle="modal" data-target="#handle_modal">
                                <i class="fa fa-external-link-square"></i> 移至
                            </button>
                            <a href="{:url('admin/'.strtolower($model).'/add', ['cropId' => $cropId])}" class="btn blue btn-circle"><i class="fa fa-plus"></i> 新增品种</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="portlet-body">
                <form id="ajax-form" class="js-ajax-form" method="post">
                    <div class="">
                        <table id="data-table" class="table table-bordered table-hover dataTable">
                            <thead>
                            <th>
                                <label class="mt-checkbox mt-checkbox-single mt-checkbox-outline">
                                    <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                                    <span></span>
                                </label>
                            </th>
                            <th>图片</th>
                            <th>品种名称</th>
                            <th>农作物</th>
                            <th>类目</th>
                            <th>排序</th>
                            <th>操作</th>
                            </thead>
                        </table>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<!-- 操作弹框 -->
<div class="modal fade" id="handle_modal" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog" style="width:700px; height: 520px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">x</button>
                <h4 class="modal-title">移至</h4>
            </div>
            <div class="portlet light">
                <div class="portlet-body">
                    <form class="form-horizontal" method="post">
                        <div class="form-body">
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            当前农作物
                                        </label>
                                        <div class="col-md-9">
                                            <p class="form-control-static"> {$cropName} </p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            移至农作物
                                        </label>
                                        <div class="col-md-9">
                                            <select class="form-control" name="cropId">
                                                {foreach name="cropList" item="crop"}
                                                <option value="{$crop.id}" {if condition="($cropId == $crop['id'])"}disabled{/if}>{$crop.name}</option>
                                                {/foreach}
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn blue move-btn"> 确定 </button>
                <button type="button" class="btn default" data-dismiss="modal"> 取消 </button>
            </div>
        </div>
    </div>
</div>

<input type="hidden" class="datalist_url" value="{:url('admin/'.strtolower($model).'/index', ['cropId' => $cropId])}">
<input type="hidden" class="edit_url" value="{:url('admin/'.strtolower($model).'/edit', ['cropId' => $cropId])}">
<input type="hidden" class="delete_url" value="{:url('admin/'.strtolower($model).'/delete')}">
<input type="hidden" class="move_url" value="{:url('admin/'.strtolower($model).'/move')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/admin/pages/js/varieties.js" type="text/javascript"></script>
{/block}